package com.itheima.sevice.impl;

import com.itheima.dao.UserDao;
import com.itheima.dao.RoleDao;
import com.itheima.pojo.Role;
import com.itheima.pojo.User;
import com.itheima.sevice.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Set;

@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private UserDao userDao;

    @Autowired
    private RoleDao roleDao;

    /**
     * 查询用户信息
     * @param username
     * @return
     */
    @Override
    public User loadUserByUsername(String username) {

        return userDao.loadUserByUsername(username);
    }

    /**
     * 查询用户角色
     * @param id
     * @return
     */
    @Override
    public Set<Role> loadRolesByUserId(Integer id) {

        return roleDao.loadRolesByUserId(id);
    }
}
